
import { GET_INIT_LIST, CHANGE_INPUT_VALUE, ADD_TODO_ITEM, DELETE_TODO_ITEM, INIT_LIST_ACTION } from './actionTypes'

export const getInputChangeAction = (value) => ({
  type: CHANGE_INPUT_VALUE,
  value
})

export const getAddItemAction = () => ({
  type: ADD_TODO_ITEM
})

export const getDeleteItemAction = (index) => ({
  type: DELETE_TODO_ITEM,
  index
})

// export const getInitAction = (data) => ({
//   type: INIT_LIST_ACTION,
//   data
// })

export const getInitList = () => ({
  type: GET_INIT_LIST
})

export const initListAction = (data) => ({
  type: INIT_LIST_ACTION,
  data
})
// export const getInitList = () => {
//   return (dispatch) => {
//     axios.get('http://localhost:8089').then(res => {
//       console.log(res)
//       const data = res.data.data
//       const action =getInitAction(data)
//       dispatch(action)
//     })
//   }
// }